package com.example.himalaya2.base;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import org.jetbrains.annotations.NotNull;

public abstract class BaseFragment extends Fragment {

    private  View mRootView;
    @Nullable
    @org.jetbrains.annotations.Nullable
    @Override
    // 创建fragment的布局。
    // 我立即的 onCreateView 参数:布局填充器，ViewGroup，保存的信息
    public View onCreateView(@NonNull @NotNull LayoutInflater inflater, @Nullable @org.jetbrains.annotations.Nullable ViewGroup container, @Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        // LayoutInflater layoutInflater = LayoutInflater.from(getContext()); // 从一个Context中，获得一个布局填充器，这样你就可以使用这个填充器来把xml布局文件转为View对象了
        mRootView = onSubViewLoaded(inflater,container);
        return mRootView;
    }

    protected abstract View onSubViewLoaded(LayoutInflater layoutInflater, @org.jetbrains.annotations.Nullable ViewGroup container);
}
